package co.com.ejb.security.fireDepartment;

import co.com.ejb.security.SecureSchoolLocalBusiness;

@Singleton
@RunAs(Roles.ADMIN)
@PermitAll
// Implicit, but included here to show access policy
public class FireDepartmentBean implements FireDepartmentLocalBusiness
{
	/**
	 * School to close in case of emergency
	 */
	@EJB
	private SecureSchoolLocalBusiness school;
	/**
	 * Ordinarily we can't close the school with no permissions,
	 * but because of @RunAs, we have ADMIN rights.
	 */
	@Override
	public void declareEmergency()
	{
		// We run as admin here, so go ahead and close the school
		school.close();
	}
}